package demo;

import java.awt.Color;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.GeneralPath;
import java.util.Vector;

public class RobotNodeDraw {
	
	Graphics2D g;
	Integer[] currentPosition = new Integer[2];
	Vector<Integer[]> trajectory;
	Vector<Integer[]> landmarks;
	GeneralPath path = new GeneralPath(GeneralPath.WIND_EVEN_ODD);
	
	
	public RobotNodeDraw(Graphics graphics ) {
		this.g = (Graphics2D) graphics;
		this.currentPosition[0] = 0;
		this.currentPosition[1] = 32;
		this.trajectory = new Vector<Integer[]>(100, 10);
		this.landmarks = new Vector<Integer[]>(10, 1);
		this.path.moveTo(this.currentPosition[0], this.currentPosition[1]);
		this.g.drawRect(this.currentPosition[0], this.currentPosition[1], 10, 10);
	}
	
	public void drawRobotPosition(int x, int y, Color color) {
		this.g.setColor(color);
		//this.g.drawRect(x, y, 10, 10);
		this.currentPosition[0] = x;
		this.currentPosition[1] = y;
		//temporary for demo
		storeRobotPosition(this.currentPosition);
	}
	
	public void storeRobotPosition(Integer[] position) {
		//temporary for demo
		this.trajectory.add(position);
	}
	
	public void drawNodePosition(int x, int y, Color color) {
		this.g.setColor(color);
		this.g.drawString("[] " + x + "," + y, x, y);
		Integer[] currentlandmark = new Integer[2];
		currentlandmark[0] = x;
		currentlandmark[1] = y;
		this.landmarks.add(currentlandmark);
	}
	
	public void drawTrajectory() {
		//temporary for demo
		int i;
		for(i=0; i< this.trajectory.size(); i++) {
			this.path.lineTo(this.trajectory.get(i)[0], this.trajectory.get(i)[1]);
		}
		this.g.draw(path);
	}

}
